<template>
  <div>

    <el-table :data="coreOrgData.records">
      <el-table-column label="名称" prop="name" width="140px"/>
      <el-table-column label="简称" prop="abbreviation"/>
      <el-table-column label="部门类型" prop="orgType">
        <template slot-scope="scope">
          <p v-if="scope.row.orgType==true">
            分公司
          </p>
          <p v-else>
            网点
          </p>
        </template>
      </el-table-column>
      <el-table-column label="省编码" prop="provinceId"/>
      <el-table-column label="市编码" prop="cityId"/>
      <el-table-column label="县编码" prop="countyId"/>
      <el-table-column label="地址" prop="address" width="200"/>
      <el-table-column label="联系电话" prop="contractNumber"/>
      <el-table-column label="描述" prop="describe"/>
      <el-table-column label="纬度" prop="latitude"/>
      <el-table-column label="经度" prop="longitude"/>
      <el-table-column label="营业时间" prop="businessHours"/>
      <el-table-column label="创建时间" prop="createTime" width="160"/>
      <el-table-column label="操作" fixed="right" width="180">
        <template slot-scope="scope">
          <el-button type="primary">
            <router-link :to="'/agencyScope-scope/'+scope.row.id">
              划分作业范围
            </router-link>
          </el-button>
        </template>
      </el-table-column>
    </el-table>


    <!--    分页-->

    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="Number(coreOrgData.current)"
      :page-sizes="[5, 10, 30, 50]"
      :page-size="Number(coreOrgData.size)"
      layout="total, sizes, prev, pager, next, jumper"
      :total="Number(coreOrgData.total)"
    >
    </el-pagination>
  </div>
</template>

<script>
import coreOrg from '@/api/base/coreOrg'
import { pca, pcaa } from 'area-data'

export default {
  name: 'index',
  data() {
    return {
      pca: pca,
      pcaa: pcaa,
      coreOrgData: {},
      pageNum: 1,
      pageSize: 5
    }
  }, methods: {
    handleCurrentChange(val) {
      this.pageNum = val
      this.queryPageCoreOrg()
    },
    handleSizeChange(val) {
      this.pageSize = val
      this.queryPageCoreOrg()

    },
    queryPageCoreOrg() {
      coreOrg.queryPage(this.pageNum, this.pageSize).then(data => {
        console.log('-', data)
        this.coreOrgData = data.data
      })
    }
  },
  mounted() {
    this.queryPageCoreOrg()
  }

}
</script>

<style scoped>

</style>
